This invention relates to the field of computer systems. More particularly, a method and apparatus are provided for preserving the contents of volatile memory in the event of a power outage.
Virtually every computing device possesses some form of volatile memory, such as RAM (Random Access Memory). Contents of volatile memory are lost when the memory's power source is turned off or interrupted, which distinguishes it from non-volatile memory (e.g., disk) that retains its contents even without continuous power. Volatile memory is generally much faster than non-volatile memory and is therefore more suitable for use as a processor's main or primary memory.
In some data processing systems—especially transactional systems that manipulate databases or file systems—processing must occasionally be halted while operational data in main memory is committed to secondary, non-volatile storage such as a disk or disk array. However, even a short pause in processing can have a significant effect on the application's throughput.
More specifically, because of the mechanical nature of a disk drive, on average half a rotation of the disk must occur before the data can be stored. For a typical disk drive this may amount to approximately 4 ms. That 4 ms may translate, in a modern processor, to more than 10 million cycles of processing time lost or wasted. If the processor blocks on a regular basis to commit memory contents to secondary storage, the effective performance of the computer system can be noticeably degraded.
Attempts to overcome this problem of performance degradation while ensuring the commitment of important data to non-volatile memory generally involve the use of NVRAM (Non-Volatile Random Access Memory). NVRAM solutions usually pair specialized volatile memory (e.g., DRAM or Dynamic RAM) with a high-capacity battery for powering the memory in case main power is lost. The transactional data is written to NVRAM memory (instead of directly to secondary storage), and then from NVRAM to secondary storage. If main power is lost, as long as the battery retains a charge the NVRAM should retain the data.
Another type of NVRAM solution requires the battery to power not only the volatile memory, but also the secondary storage to which the memory's contents are written. The battery powers both components to allow the memory to be flushed to storage.
However, these types of solution can be very expensive and therefore unsuitable for use in low-end computer systems that must have relatively low costs. One reason for the high cost associated with NVRAM is the specialized battery. In the latter type of NVRAM solution, the battery must be designed to provide a large amount of power (e.g., disk drives may require 20-30 watts each for a period of several minutes). In the former type of solution, the battery must retain its charge for a significant period of time (e.g., weeks) in case of an extended downtime. In addition, the engineering involved in supplying power from a battery with little or no risk of fire adds to the cost.
Another reason NVRAM solutions are expensive is that they often use special low-power memory. Conventional forms of volatile memory, such as DIMMs (Dual Inline Memory Module), would exhaust the battery power in a shorter period of time.
In modern computer systems, it is common to combine NVRAM with a storage subsystem (e.g., a storage array). For example, an NVRAM component may be situated within a storage array that is separated from the processor by a network (e.g., an SAN or Storage Array Network), rather than being located within the computer system that relies on the NVRAM to preserve transaction data. Such a combination provides an abstraction of a large capacity storage system that is not subject to the delay associated with disk rotation.
But, a different problem arises when an NVRAM component is located remote from the processor that generates the transaction data to be stored. In particular, in the event of a power failure in the network, it is possible that the transaction data will have been written to non-volatile storage without delivery of an acknowledgement to the main computer, thereby rendering transaction status inconsistent or ambiguous. From the point of view of the non-volatile storage the transaction will be committed, but to the computer memory the transaction will seem uncommitted. If the power failure subsequently affects the main computer, the inconsistency may become permanent.
On the other hand, if the NVRAM component is situated proximate to the processor, such as on the same motherboard, then it may become very difficult or even impossible to retrieve the data it retains in the event of a major system failure. In particular, if the processor (or other primary component of the motherboard) fails, data from a transaction that is deemed completed may remain in the NVRAM without having been written to secondary storage. If the entire motherboard must be replaced, the NVRAM data may become irretrievable or, if the battery back-up power is disconnected, may dissipate.